package com.egg.ylt.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.egg.ylt.R;
import com.egg.ylt.Utils.CustomUtils;
import com.egg.ylt.Utils.StatusBarUtil;
import com.yonyou.framework.library.base.BaseActivity;
import com.yonyou.framework.library.bean.ErrorBean;

import butterknife.BindView;
import butterknife.OnClick;

public class ACT_SelectBaby extends BaseActivity {

    public static final String KEY_RESOURCE_TYPE = "key_resource_type";

    @BindView(R.id.include_iv_back)
    ImageView includeIvBack;
    @BindView(R.id.include_tv_title)
    TextView includeTvTitle;
    @BindView(R.id.include_tv_right)
    TextView includeTvRight;
    @BindView(R.id.include_rl_view)
    RelativeLayout includeRlView;
    @BindView(R.id.ll_baby_boy)
    LinearLayout llBabyBoy;
    @BindView(R.id.ll_baby_girl)
    LinearLayout llBabyGirl;

    private int mResource;

    @Override
    protected void getBundleExtras(Bundle extras) {
        mResource = extras.getInt(KEY_RESOURCE_TYPE);
    }

    @Override
    protected int getContentViewLayoutID() {
        return R.layout.act_select_baby;
    }

    @Override
    protected View getLoadingTargetView() {
        return null;
    }

    @Override
    protected void initViewsAndEvents() {

        StatusBarUtil.setStatusBarColor(this, R.color.ylt_whit);
        StatusBarUtil.StatusBarLightMode(this);
        CustomUtils.setImmersiveStatusBar(mContext, includeRlView);
        //设置title
        includeTvTitle.setText("选择宝宝");
    }

    @Override
    protected boolean isApplyStatusBarTranslucency() {
        return false;
    }

    @Override
    protected boolean isBindEventBusHere() {
        return false;
    }

    @Override
    protected boolean toggleOverridePendingTransition() {
        return false;
    }

    @Override
    protected TransitionMode getOverridePendingTransitionMode() {
        return null;
    }

    @Override
    protected boolean isApplyKitKatTranslucency() {
        return false;
    }

    @Override
    public void showBusinessError(ErrorBean error) {

    }

    @OnClick({R.id.include_iv_back, R.id.ll_baby_boy, R.id.ll_baby_girl})
    public void onClick(View view) {
        Intent intent = new Intent();
        switch (view.getId()) {
            case R.id.include_iv_back://返回键
                finish();
                break;
            case R.id.ll_baby_boy://男
                intent.putExtra("sex", "0");
                intent.putExtra(KEY_RESOURCE_TYPE, mResource);
                readyGo(ACT_EditBabyInfo.class, intent);
                break;
            case R.id.ll_baby_girl:// 女
                intent.putExtra("sex", "1");
                intent.putExtra(KEY_RESOURCE_TYPE, mResource);
                ;
                readyGo(ACT_EditBabyInfo.class, intent);
                break;
        }
    }

    public static void startActResource(Context context, int resource) {
        Intent intent = new Intent(context, ACT_SelectBaby.class);
        Bundle bundle = new Bundle();
        bundle.putInt(KEY_RESOURCE_TYPE, resource);
        intent.putExtras(bundle);
        context.startActivity(intent);
    }

}
